// ignore_for_file: file_names, unnecessary_question_mark, unnecessary_this, slash_for_doc_comments

import 'package:mybase/base/tool/empty/FFEmpty.dart';

/**扩展Map，安全取值*/
extension FFMapExt on Map {

  /**安全取值 */
  dynamic safeValue<T>(dynamic key) {
    if (key == null) return null;
    if (FFEmpty.mapIsEmpty(this)) return null;
    if(this.containsKey(key) == false) return null;

    dynamic tmp = this[key];
    if (tmp is T) {
      return tmp;
    }
    return null;
  }
}
